<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class testtab extends Model
{
    use HasFactory;
    protected $table = 'testtab';  // 指定表名
    protected $guarded = []; // 允许所有字段批量赋值

     /**
     * 动态设置表名
     */
    public function getTable()
    {;
        // 根据年月生成表名
        return 'testtab_' .date('Y');
    }
}
